
export default (self, categorys, factorys, styles, feeds) => [
  {
    title: '名称',
    name: 'name',
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入商品名称'
        }
      ],
    },
    searchItem: {}
  },
  {
    title: '类别',
    name: 'categoryId',
    dict: categorys,
    formItem: {
      type: 'select',
      otherkey: true,
      otherkeyName: '_id',
      rules: [
        {
          required: true,
          message: '请输入商品类别'
        }
      ],
    },
    searchItem: {}
  },
  {
    title: '风格',
    name: 'style',
    dict: styles,
    formItem: {
      type: 'select',
      otherkey: true,
      otherkeyName: '_id',
      rules: [
        {
          required: true,
          message: '请输入商品风格'
        }
      ],
    },    
    searchItem: {}
  },
  {
    title: '尺寸',
    name: 'size',
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入商品尺寸'
        }
      ],
    },    
    searchItem: {}
  },
  {
    title: '材质',
    name: 'texture',
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入商品材质'
        }
      ],
    },    
    searchItem: {}
  },
  {
    title: '厂家',
    name: 'factory',
    dict: factorys,
    formItem: {
      type: 'select',
      otherkey: true,
      otherkeyName: '_id',
      rules: [
        {
          required: true,
          message: '请输入商品厂家'
        }
      ],
    },    
    searchItem: {}
  },
  {
    title: '售价',
    name: 'price',
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入商品售价'
        }
      ],
    },    
    searchItem: {}
  },
  {
    title: '进价',
    name: 'inPrice',
    formItem: {
      rules: [
        {
          required: true,
          message: '请输入商品进价'
        }
      ],
    },    
    searchItem: {}
  },
  {
    title: '描述',
    name: 'desciption',
    formItem: {
      rules: [
        {
          required: false,
          message: '请输入商品描述'
        }
      ],
    },   
    searchItem: {}
  },
  {
    title: '备注',
    name: 'remark',
    formItem: {
      rules: [
        {
          required: false,
          message: '请输入商品备注'
        }
      ],
    },   
    searchItem: {}
  },
  {
    title: '加料一',
    name: 'feed[0]',
    formItem: {
      formItemLayout: {
        labelCol: { span: 12 },
        wrapperCol: { span: 12 }
      },
      col: { span: 12 },
      dataType: 'array',
      dataIndex: '0',
      fatherKeyName: "feed",
      keyName: 'feed',
    },   
    searchItem: {}
  },
  {
    title: '加料价格一',
    name: 'feedprice[0]',
    formItem: {
      formItemLayout: {
        labelCol: { span: 6 },
        wrapperCol: { span: 12 }
      },
      col: { span: 12 },
      dataType: 'array',
      dataIndex: '0',
      fatherKeyName: "feed",
      keyName: 'feedprice',
    },   
    searchItem: {}
  },
  {
    title: '加料二',
    name: 'feed[1]',
    formItem: {
      formItemLayout: {
        labelCol: { span: 12 },
        wrapperCol: { span: 12 }
      },
      col: { span: 12 },
      dataType: 'array',
      dataIndex: '1',
      fatherKeyName: "feed",
      keyName: 'feed',
    },   
    searchItem: {}
  },
  {
    title: '加料价格二',
    name: 'feedprice[1]',
    formItem: {
      formItemLayout: {
        labelCol: { span: 6 },
        wrapperCol: { span: 12 }
      },
      col: { span: 12 },
      dataType: 'array',
      dataIndex: '1',
      fatherKeyName: "feed",
      keyName: 'feedprice',
    },   
    searchItem: {}
  },
  {
    title: '加料三',
    name: 'feed[2]',
    formItem: {
      formItemLayout: {
        labelCol: { span: 12 },
        wrapperCol: { span: 12 }
      },
      col: { span: 12 },
      dataType: 'array',
      dataIndex: '2',
      fatherKeyName: "feed",
      keyName: 'feedprice',
    },   
    searchItem: {}
  },
  {
    title: '加料价格三',
    name: 'feedprice[2]',
    formItem: {
      formItemLayout: {
        labelCol: { span: 6 },
        wrapperCol: { span: 12 }
      },
      col: { span: 12 },
      dataType: 'array',
      dataIndex: '2',
      fatherKeyName: "feed",
      keyName: 'feedprice',
    },   
    searchItem: {}
  },
  {
    title: '库存状态',
    name: 'status',
    formItem: {
      initialValue: 200,
      rules: [
        {
          required: true,
          message: '请选择库存状态'
        }
      ],
    },
    searchItem: {}
  },
  {
    title: '售卖状态',
    name: 'saleStatus',
    formItem: {
      type: 'select',
      dict: [
        {code: 'onsale',codeName: '上架'},
        {code: 'disabled',codeName: '下架'},
      ],
      initialValue: 'onsale',
      rules: [
        {
          required: true,
          message: '请选择售卖状态'
        }
      ],
    },
    searchItem: {}
  },
  {
    title: '商品图片',
    name: 'goodspic',
    formItem: {
      type: 'upload',
      listType: 'picture',
      datakey: 'picId',
      pickey: 'url',
      picid: '_id',
      action: '/upload',
      rules: [
        {
          required: false,
          message: '请选商品图片'
        }
      ],
      maxFileSize: 3000, // 最大限制 kb
      fileTypes: ['.png', '.jpg', '.gif'], // 允许类型
      max: 5
    }
  },
];
